import axios from 'axios'

export default app => {
  app.config.errorHandler = (err, instance, info) => {
    console.error(err)

    axios.post('http://36.99.193.53:8000/api/error', {
      title: document.title,
      url: location.href,
      error: {
        name: err.name,
        message: err.message,
        stack: err.stack,
      },
    })
  }
}
